package cn.com.ddapp.ddm.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import android.widget.VideoView;

import com.zhy.autolayout.utils.AutoUtils;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.com.ddapp.ddm.R;
import cn.com.ddapp.ddm.bean.DetailsBean;

/**
 * Created by Administrator on 2016/9/1 0001.
 */
public class UserPepoleAdapter extends BaseAdapter{
    private Context context;
    private List<DetailsBean.DetailBean.GoodKey> gList;

    public UserPepoleAdapter(Context context,List<DetailsBean.DetailBean.GoodKey> gList) {
        this.context = context;
        this.gList=gList;
    }

    @Override
    public int getCount() {
        return gList!=null ?gList.size():0;
    }

    @Override
    public Object getItem(int i) {
        return gList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder = null;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.item_yonghu_day, viewGroup, false);
            holder=new ViewHolder(view);
            view.setTag(holder);
            AutoUtils.auto(view);
        }else {
            holder= (ViewHolder) view.getTag();
        }
        DetailsBean.DetailBean.GoodKey  bean=gList.get(i);
      holder.value_key.setText(bean.getParentName()+": "+bean.getName());

        return view;
    }

    class ViewHolder {
        @BindView(R.id.value_key)
        TextView value_key;
        @BindView(R.id.value_name)
        TextView value_name;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
